import { createElements, define, itag } from "../itag/index.js";
import * as styles from "./styles.js";

/**
 * 一条日志消息
 */
export class MessageElement extends HTMLPreElement {
    readonly #elms = createElements({
        code: "code",
    });

    constructor() {
        super();

        itag`
${this}  .${styles.message}
    ${this.#elms.code} 
`;
    }

    get message(): string {
        return this.#elms.code.textContent ?? "";
    }
    set message(message: string) {
        this.#elms.code.textContent = message;
    }
}

define("message-element", MessageElement, {
    extends: "pre",
});
